package com.htu.controller;

import com.htu.po.User;
import com.htu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@ResponseBody
public class UserController {
    @Autowired
    private UserService userService;
    @RequestMapping("/getUserById")

    public User getUserById(String userId){
        return userService.getUserById(userId);
    }
    @RequestMapping("/saveUser")
    public int saveUser(User user){
        return userService.saveUser(user);
    }
    @RequestMapping("/getUserByIdByPass")
    public User getUserByIdByPass(@RequestParam("userId") String userId , @RequestParam("password") String password){
        User user = new User();
        user.setUserId(userId);
        user.setPassword(password);
        return userService.getUserByIdByPass(userId,password);
    }
}
